#include "rclcpp/rclcpp.hpp"
#include "data_reflow/config_manager.h"

int main(int argc, char *argv[])
{
    // 初始化ROS
    rclcpp::init(argc, argv);
    auto node = rclcpp::Node::make_shared("test_config_manager");

    // 获取配置文件路径
    std::string config_path = "src/data_reflow/config/config.yaml";
    RCLCPP_INFO(node->get_logger(), "配置文件路径路径: %s", config_path.c_str());

    // 加载配置
    auto &config_manager = data_reflow::ConfigManager::get_instance();
    bool load_success = config_manager.load_config(config_path);

    if (!load_success)
    {
        RCLCPP_ERROR(node->get_logger(), "配置文件加载失败，退出测试");
        rclcpp::shutdown();
        return 1;
    }

    // 测试配置读取功能
    RCLCPP_INFO(node->get_logger(), "开始测试配置读取...");

    int buffer_size = config_manager.get_int("buffer_size", 500);
    RCLCPP_INFO(node->get_logger(), "buffer_size: %d (输入参数: 500)", buffer_size);

    bool record_camera = config_manager.get_bool("record_camera", false);                                   
    RCLCPP_INFO(node->get_logger(), "record_camera: %s (输入参数: false)", record_camera ? "true" : "false"); 

    RCLCPP_INFO(node->get_logger(), "配置测试完成");
    rclcpp::shutdown();
    return 0;
}